<template lang="pug">
  .page-breadcrumb
    el-breadcrumb(separator="/")
      el-breadcrumb-item(v-for="(item, index) in breadItems", :key="index") {{ item }}
</template>
<script>
  import { menuList, routerPath } from './menuList.js'

  export default {
    data () {
      return {
        breadItems: []
      }
    },
    mounted() {
      this.beforeRoute();
    },
    methods: {
      beforeRoute () {
        let breadcrumbList = {}
        let path = this.$route.path;
        if (path == '/') return;
        path = path.match(/[a-zA-Z]+/g).join('_')
        this.breadItems = routerPath[path]['breadcrumb']
      }
    },
    watch: {
      $route: 'beforeRoute'
    }
  }
</script>
<style lang="stylus">
.page-breadcrumb
  position absolute
  top 0px
  left 250px
  right 0px
  padding 20px
  background #F5F5F5
</style>
